package pattern.structural.flyweight.simple;

/**
 * @author: chaoyang.ren  
 * @date:Jul 13, 2017  
 * @time:2:22:20 PM   
 * @email:chaoyang.ren@foxmail.com  
 * @version: 1.0
 */
public class Test {
	public static void main(String[] args) {
	    Flyweight fly1 = FlyweightFactory.getFlyweight("a");  
	    fly1.action(1);  
	      
	    Flyweight fly2 = FlyweightFactory.getFlyweight("a");  
	    System.out.println(fly1 == fly2);  
	      
	    Flyweight fly3 = FlyweightFactory.getFlyweight("b");  
	    fly3.action(2);  
	      
	    Flyweight fly4 = FlyweightFactory.getFlyweight("c");  
	    fly4.action(3);  
	      
	    Flyweight fly5 = FlyweightFactory.getFlyweight("d");  
	    fly5.action(4);  
	      
	    System.out.println(FlyweightFactory.getSize());
	}
}

